<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Worldmusic | Modern Admin</title>
<link rel="stylesheet" type="text/css" href="css/960.css" />
<link rel="stylesheet" type="text/css" href="css/loginadmin.css">
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/text.css" />
<link rel="stylesheet" type="text/css" href="css/blue.css" />
<link type="text/css" href="css/smoothness/ui.css" rel="stylesheet" />  
<link rel="stylesheet" href="febe/style.css" type="text/css" media="screen" charset="utf-8">
<script src="argiepolicarpio.js" type="text/javascript" charset="utf-8"></script>
<script src="js/application.js" type="text/javascript" charset="utf-8"></script>	
<!--sa poip up-->
<link href="src/facebox.css" media="screen" rel="stylesheet" type="text/css" />
   <script src="lib/jquery.js" type="text/javascript"></script>
  <script src="src/facebox.js" type="text/javascript"></script>
  <script type="text/javascript">
    jQuery(document).ready(function($) {
      $('a[rel*=facebox]').facebox({
        loadingImage : 'src/loading.gif',
        closeImage   : 'src/closelabel.png'
      });
    });
  </script>
</head>
<body>
	<div class="container_16" id="wrapper">
		<div style="position:relative;">
		<div class="grid_8" id="logo">Administration</div>
	    <div class="grid_8">
			<div id="user_tools">
				<?php
				session_start();
				if (!isset($_SESSION['admin'])) {
				?>
				<form id="adlog"method = "POST" action="adminlogin.php">
					<ul>
						<li>Đăng nhập:</li>
						<li>
							<div id="logbox">
								<input id="username" name="username" value="" type="text" autocomplete="on" placeholder="Username">
							</div>
						</li>
						<li>
							<div id="logbox">
								<input id="password" name="password" value="" type="password" placeholder="Password">
							</div>
						</li>
						<li><button class="submit" type="submit">Đăng nhập</button></li>
					</ul>
          		</form>
          		<?php } else { ?>
				<span><a href="../admin/logout.php">Logout</a></span>
				<?php }?>
			</div>
	    </div>
	<!-- USER TOOLS END -->    
	<div class="grid_16" id="header">
	<!-- MENU START -->
	<div id="menu">
		<ul class="group" id="menu_group_main">
			<li class="item first" id="one"><a href="index.php" class="main current"><span class="outer"><span class="inner dashboard">User</span></span></a></li>
			<li class="item last" id="eight"><a href="products.php" class="main"><span class="outer"><span class="inner settings">Products</span></span></a></li>        
	    </ul>
	</div>
	<!-- MENU END -->
	</div>
	<!-- CONTENT START -->
	    <div class="grid_16" id="content">
	    <!--  TITLE START  --> 
	    <div class="grid_9">
	    <h1 class="dashboard">User</h1>
	    </div>
	    <div class="clear">
	    </div>
	    <!--  TITLE END  -->    
	    <!-- #PORTLETS START -->
	    <div id="portlets">
	    
		<!--  SECOND SORTABLE COLUMN END -->
	    <div class="clear"></div>
	    <!--THIS IS A WIDE PORTLET-->
			<div class="portlet">
				<div class="portlet-content nopadding">
				<form action="" method="post">
				
				<table cellpadding="1" cellspacing="1" id="resultTable">
					<thead>
						<tr>
							<th> Name </th>
							<th> Address </th>
							<th> Email </th>
							<th> Action</th>
						</tr>
					</thead>
					<tbody>
					<?php
					include '../config.php'; 
					if (isset($_SESSION['admin'])) {
						$result = mysql_query("SELECT * FROM user ORDER BY uID ASC");
						while($row = mysql_fetch_array($result)){
								echo '<tr class="record" id="'.$row['uID'].'">';
								echo '<td>'.$row['Firstname'].' '.$row['Lastname'].'</td>';
								echo '<td><div align="left">'.$row['uAddress'].'</div></td>';
								echo '<td><div align="left">'.$row['Email'].'</div></td>';
								echo '<td><div align="center"><a href="#" id="'.$row['uID'].'" class="delbutton" title="Click To Delete">delete</a></div></td>';
								echo '</tr>';
						}
					}
						?> 
					</tbody>
				</table>
				</form>
				</div>
			</div>
	<!--  END #PORTLETS -->  
	   	</div>
	    <div class="clear"> </div>
	<!-- END CONTENT-->    
	  	</div>
	<div class="clear"> </div>

	</div>
	</div>
	<!-- WRAPPER END -->
	<!-- FOOTER START -->
	<div class="container_16" id="footer">
	Website Administration by <a href="https://www.facebook.com/tqkhah29">Khánh Trương</a></div>
	<!-- FOOTER END -->

	<!--To confirm delete before calling deleteres.php-->
	<script src="js/jquery.js"></script>
	  <script type="text/javascript">
	$(function() {


	$(".delbutton").click(function(){

	//Save the link in a variable called element
	var element = $(this);

	//Find the id of the link that was clicked
	var del_id = element.attr("id");

	//Built a url to send
	var info = 'id=' + del_id;
	 if(confirm("Sure you want to delete this update? There is NO undo!"))
			  {

	 $.ajax({
	   type: "GET",
	   url: "deluser.php",
	   data: info,
	   success: function(){
	   
	   }
	 });
	         $(this).parents(".record").animate({ backgroundColor: "#fbc7c7" }, "fast")
			.animate({ opacity: "hide" }, "slow");

	 }

	return false;

	});

	});
	</script>
</body>
</html>